<template>
  <div class="app-container" style="margin-top: 30px;padding:30px 0;border-top:1px solid #ccc;">
    <el-form :inline="true" ref="ruleForm" :model="formInline" class="demo-form-inline">
      <el-form-item label="策略生成时间" prop="time">
        <el-date-picker
          v-model="formInline.date"
          type="datetimerange"
          unlink-panels
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="['00:00:00', '23:59:59']"
          value-format="yyyy-MM-dd HH:mm:ss"
          align="right">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="用户层级" prop="levelId">
        <el-select v-model="formInline.levelId" placeholder="请选择用户层级">
          <el-option
            v-for="item in levelList"
            :label="item.name"
            :key="item.levelId"
            :value="item.levelId"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="$emit('on-filter',formInline)">搜索
      </el-button>
      <el-button @click="selfResetForm('ruleForm')">重置</el-button>
    </el-form>
  </div>

</template>

<script>
  import {getAuditApplierList, getAuditManList} from '@/services/api/audit'
  import {form, pickerOption} from '@/build'
  import {getUserLevelList} from "@/services/api/userLevel";

  export default {
    name: "strategy-filter",
    mixins: [form, pickerOption],
    data() {
      return {
        auditApplyList: [],
        auditManagerList: [],
        levelList: [],
        formInline: {
          levelId: undefined,
          date: [moment(consts.ONLINE_DATE).format('YYYY-MM-DD 00:00:00'), moment().format('YYYY-MM-DD 23:59:59')],
        },

      }
    },
    methods: {
      selfResetForm(formName) {
        this.resetForm(formName)
        this.$parent.getAll()
      },
      formSubmit() {
        this.gridSearch()
      }
    },
    mounted() {
      this.bindGet(getUserLevelList, 'levelList', {});
      this.getAll()
    }
  }
</script>

<style lang="scss" scoped>
  .with-pre-select {
    .el-input-group__prepend {
      .el-select {
        width: 120px;
      }
    }
  }

  .money-range {
    .el-input {
      width: 100px;
    }
  }

</style>
